package com.example.login_register;

import static android.util.Log.v;

import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.view.View;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class registerActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_register);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });


        EditText edit_2 = findViewById(R.id.et_password);
        EditText edit_3 = findViewById(R.id.editText3);
        Button btn_1 = findViewById(R.id.button3);
        Button btn_login = findViewById(R.id.btn_login);
        TextView tv_1 = findViewById(R.id.tv_1);
        tv_1.setOnClickListener(v ->
        {
            finish();
        });
        btn_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String a = edit_2.getText().toString().trim();
                String b = edit_3.getText().toString().trim();
                if (!a.equals(b)) {
                    btn_1.setVisibility(Button.VISIBLE);
                } else {
                    btn_1.setVisibility(Button.GONE);
                }
            }
        });

        btn_1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                btn_1.setVisibility(Button.GONE);
            }
        });
    }
}